within ThreeD_MBS_Dynamics.Examples;

model Test_Disc
  import ThreeD_MBS_Dynamics;
  parameter SI.Acceleration g=9.81;
  parameter SI.Acceleration[3] Gravity={0,-g,0};
  parameter SI.Radius r1=2;
  parameter SI.Mass m_disc=1;
  parameter SI.AngularVelocity omega0=1;
  parameter Real alpha=Modelica.Constants.pi/4;
  Base Base1 annotation (extent=[-80, -20; -40, 20]);
  Disc_on_Base Disc_on_Plane1 annotation (extent=[-20, -20; 20, 20]);
  RollingDisc RollingDisc1(
    Gravity=Gravity,
    r1=r1,
    F1=zeros(3),
    M1=zeros(3),
    q(start={cos(alpha/2),sin(alpha/2),0,0}),
    I=m_disc*[0.25*r1^2, 0, 0; 0, 0.25*r1^2, 0; 0, 0, 0.5*r1^2],
    v(start={-r1*omega0,0,0}),
    omega(start={0,-omega0*sin(alpha),omega0*cos(alpha)}),
    r(start={0,r1*cos(alpha),r1*sin(alpha)})) 
    annotation (extent=[40, -20; 80, 20]);
  annotation (
    Diagram,
    experiment(
      StopTime=50,
      NumberOfIntervals=25000,
      Tolerance=1e-009),
    experimentSetupOutput);
equation
  connect(Disc_on_Plane1.OutPortB, RollingDisc1.InPortRoll) 
    annotation (points=[6, 18; 6, 30; 54, 30; 54, 18]);
  connect(Base1.OutPort, Disc_on_Plane1.InPortA) 
    annotation (points=[-60,-18; -60,-30; -6,-30; -6,-18]);
  connect(Disc_on_Plane1.InPortB, RollingDisc1.OutPort) 
    annotation (points=[6, -18; 6, -30; 60, -30; 60, -18]);
end Test_Disc;
